import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:provide/provide.dart';
class DetailsTabbar extends StatelessWidget {

  bool isLeft = true;
  bool isRight = false;

  @override
  Widget build(BuildContext context) {
    return Container(
      margin: EdgeInsets.only(top: 15),
      child: Row(
        children: <Widget>[
          _myTabbarLeft(context, true),
          _myTabbarRight(context, false)
        ],
      ),
    );
  }

  Widget _myTabbarLeft(BuildContext context,bool isLeft){
    return InkWell(
      onTap: (){
        this.isLeft = true;
        this.isRight = false;
      },
      child: Container(
        padding: EdgeInsets.all(10),
        alignment: Alignment.center,
        width: ScreenUtil().setWidth(375),
        decoration: BoxDecoration(
          color: Colors.white,
          border: Border(
            bottom: BorderSide(
              width: 1,
              color: isLeft? Colors.pink : Colors.black12,
            )
          )
        ),
        child: Text(
          '详情',
          style: TextStyle(
            color: isLeft ? Colors.pink : Colors.black12,
          ),
        ),
      ),
    );
  }

  Widget _myTabbarRight(BuildContext context,bool isRight){
    return InkWell(
      onTap: (){
        this.isLeft = false;
        this.isRight = true;
      },
      child: Container(
        padding: EdgeInsets.all(10),
        alignment: Alignment.center,
        width: ScreenUtil().setWidth(375),
        decoration: BoxDecoration(
            color: Colors.white,
            border: Border(
                bottom: BorderSide(
                  width: 1,
                  color: isRight? Colors.pink : Colors.black12,
                )
            )
        ),
        child: Text(
          '评论',
          style: TextStyle(
            color: isRight ? Colors.pink : Colors.black12,
          ),
        ),
      ),
    );
  }
}


